
import 'package:flutter/material.dart';
import 'package:jd_shopping/pages/Coustom/JdButton.dart';
import 'package:jd_shopping/services/ScreenAdaper.dart';


class ReisterFirst extends StatefulWidget {
  @override
  _ReisterFirstState createState() => _ReisterFirstState();
}

class _ReisterFirstState extends State<ReisterFirst> {

  String _dropdownValue = '+88';
  List dropdownData = ['+88','+89','+90','+91','+92','+93','+94','+95','+96','+97','+98'];

  //设置itmes组。。。。
 dropdownItems(){
    List<DropdownMenuItem<String>> list =  List();
    dropdownData.forEach((value){
      list.add(
         DropdownMenuItem(
            child:  Container(
                margin: EdgeInsets.fromLTRB(5, 0, 0, 0),
                color: Colors.white,
                child:  Text(value,style: TextStyle(color: Colors.black),),
            ),
            value: value,
        ),
      );
    });
    return list;
  }

  @override
  Widget build(BuildContext context) {
    ScreenAdaper.init(context);
    return Scaffold(
      appBar: AppBar(title: Text('手机快速注册')),
      body: ListView(
        children: <Widget>[
          SizedBox(height: ScreenAdaper.height(30)),
          Container(
              decoration: BoxDecoration(
                border: Border.all(width: 1, color: Colors.black12),
                color: Colors.white,
              ),
              margin: EdgeInsets.fromLTRB(10, 0, 10, 0),
              height: ScreenAdaper.height(80),
              child: Row(
                children:[
                  DropdownButton(
                      value: this._dropdownValue,
                      icon: Icon(Icons.arrow_drop_down),
                      style: TextStyle(color: Colors.grey),
                      underline: Container(
                        height: 0,
                        color: Colors.white,
                      ),
                      items: dropdownItems(),
                      onChanged:(value){
                        setState((){
                          print(value);
                          this._dropdownValue = value;
                          }
                        );
                      }
                  ),
                  Expanded(
                      flex: 1,
                      child: TextField(
                        obscureText: false,
                        decoration: InputDecoration(
                            contentPadding:
                                const EdgeInsets.symmetric(vertical: 10.0),
                            hintText: '请输入手机号',
                            border: OutlineInputBorder(
                                borderSide: BorderSide.none)),
                        onChanged: (value) {
                          print(value);
                        },
                      )
                    )
                ],
              )),
          SizedBox(height: ScreenAdaper.height(30)),
          JdButton(
            color: Colors.red,
            text: '下一步',
            cb: () {
              print('123');
               Navigator.pushNamed(context, '/regsecond');
            },
          ),
          SizedBox(height: ScreenAdaper.height(30)),
          Container(
              margin: EdgeInsets.fromLTRB(10, 0, 10, 0),
              child: Row(
                children: <Widget>[
                  Text('遇到问题你可以'),
                  InkWell(
                    child: Text(
                      '联系客服',
                      style: TextStyle(
                        decoration: TextDecoration.underline,
                      ),
                    ),
                    onTap: () {
                      print('联系客服');
                    },
                  )
                ],
              ))
        ],
      ),
    );
  }
}
